%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Program: assign_parameters.m
%%% By: Martin Shu, David Lagakos, Simeon Alder, Lee Ohanian
%%% Date: January 27,2023
%%% Purpose: Solves ALO model for JPE revision
%%% Note: uses Fsolve to clear mkts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Set Path + other technical values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% record output in diary file
% diary (['diary file - ' diaryName]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Set Parameter Values 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

nPeriods = 51; % number of time periods; 51 to compare to data (1950 
               % through 2000); e.g. 5 or 10 to experiment with model

% Number of goods in each economy
% ngoods = 8; % for testing code, though moments far off
ngoods = 1793; % for quantitative work

% parameters for investment cost function
alpha = 0.187847; % scale parameter in the investment cost function
gamma = 2.00; % power on x in the investment cost function (curvature)

% Fraction of rust belt goods in Home
lambda = 0.46152;


% elasticities of substitution
sigma = 2.54123; % Inter-good elasticity of substitution
rho = 2.76005; % Intra-good elasticity of substitution between H and F

% foreign RB productivity growth
zeta_F_RB = 1.03545; % exogenous productivity growth of foreign RB
%%% zeta_F_RB = 1.000; %% counterfactual with no international forces

% trade variables
tau0 = 9.048486; % Iceberg trade cost, initial level
delta_tau = 0.97175; % Annual fall in trade costs

% labor conflict variables
kappa = 0.12; % Fraction of output lost
phi_R = 0.43747; % Fraction of profits going to unions as rents, rust belt
phi_S = 0.018331; % Fraction of profits going to unions as rents, sun belt

% firm investment rule
s = 0.44353; % Fraction of retained profits reinvested

% Increase sigmazH for higher strike probability
sigmazH = 0.08696; % Dispersion parameter for distribution of productivity shocks in Home each period

% Parameters for initial productivity distribution
sigmazH0 = 1.140045; % Dispersion of productivity in Home
sigmazF0 = sigmazH0; % Dispersion of productivity in Foreign
zbarH0 = -sigmazH0^2/2; % Location parameter for distribution of zH
zbarF0 = -sigmazF0^2/2; % Location parameter for distribution of zF
LS = 1; % Labor supply in each country

% target strike rates -- useful for initial guesses
target_strike_rate_RB = 0.192; % target strike rate of rust belt goods
target_strike_rate_SB = 0.026; % target strike rate of sun belt goods
